<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编写帖子</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <!--Editor.md-->
<!--    <link rel="stylesheet" th:href="@{static/editormd/css/style.css}"/>-->
    <link rel="stylesheet" th:href="@{static/editormd/css/editormd.css}"/>
    <link rel="shortcut icon" href="../../static/asserts/images/login_logo.png" />

    <!-- Style Sheet-->
    <link rel='stylesheet' id='bootstrap-css-css'  href='../../static/asserts/css/bootstrap5152.css?ver=1.0' type='text/css' media='all' />
    <link rel='stylesheet' id='responsive-css-css'  href='../../static/asserts/css/responsive5152.css?ver=1.0' type='text/css' media='all' />
    <link rel='stylesheet' id='pretty-photo-css-css'  href='../../static/asserts/js/prettyphoto/prettyPhotoaeb9.css' type='text/css' media='all' />
    <link rel='stylesheet' id='main-css-css'  href='../../static/asserts/css/main.css' type='text/css' media='all' />

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="../../static/asserts/js/html5.js"></script></script>
    <![endif]-->
</head>

<body>
<!-- Start of Header -->
<div th:replace="commons/bar::topbar"></div>
<!-- End of Header -->
<div class="layui-fluid" style="background-image: url('../../static/asserts/images/editormd-bg.jpg')">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <!--博客表单-->
            <form name="mdEditorForm" >
                <br>
                <div align="center" class="editormd-class">
                    <select name="category" class="search-class" style="height: 37px; margin-bottom: 0; width: 100px" required="required">
<!--                        <option  value="1" class="select-opt">资源共享</option>-->
                        <option  value="2" class="select-opt">校园周边</option>
<!--                        <option  value="3" class="select-opt">讨论区</option>-->
                        <option  value="4" class="select-opt">刷题</option>
                        <option  value="5" class="select-opt">课程推荐</option>
                        <option  value="6" class="select-opt" th:if="${session.level}==0">公告</option>
                        <option  value="7" class="select-opt" th:if="${session.level}==0">课程</option>
                    </select>

<!--                    <span style="color: #4b5760; font-size: 17px;line-height: 19px;font-weight: 600;">要求等级<input type="text" name="level" style="margin-bottom: 0"></span><br /><br />-->

                    <span style="color: #4b5760; font-size: 17px;line-height: 19px;font-weight: 600;">标题：<input type="text" name="title" style="margin-bottom: 0" onFocus="this.value=''" value="暂无标题"></span>
                    <select name="level" class="search-class" style="height: 37px; margin-bottom: 0; width: 120px">
                        <option  value="1" class="select-opt" selected>请选择权限</option>
                        <option  value="1" class="select-opt">1</option>
                        <option  value="2" class="select-opt">2</option>
                        <option  value="3" class="select-opt">3</option>
                        <option  value="4" class="select-opt">4</option>
                        <option  value="5" class="select-opt">5</option>
                        <option  value="6" class="select-opt">6</option>
                        <option  value="7" class="select-opt">7</option>
                    </select>

                    <br /><br />


                </div><br>
                <center><p  th:text="${session.msg}" th:if="${not #strings.isEmpty(session.msg)}"></p></center>
                <div id="article-content">
                    <textarea name="content" id="content" style="display:none;" required="required"></textarea>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script th:src="@{../../static/editormd/js/jquery.min.js}"></script>
<script th:src="@{../../static/editormd/js/editormd.min.js}"></script>

<script type="text/javascript">

    var testEditor;

    //window.onload = function(){ }
    $(function () {
        testEditor = editormd("article-content", {
            width: "80%",
            height: 1000,
            syncScrolling: "single",
            path: "../editormd/lib/",
            saveHTMLToTextarea: true,    // 保存 HTML 到 Textarea
            emoji: true,
            // theme: "dark",//工具栏主题
            // previewTheme: "dark",//预览主题
            // editorTheme: "pastel-on-dark",//编辑主题
            tex: true,                   // 开启科学公式TeX语言支持，默认关闭
            flowChart: true,             // 开启流程图支持，默认关闭
            sequenceDiagram: true,       // 开启时序/序列图支持，默认关闭,
            //图片上传
            imageUpload: true,
            imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
            imageUploadURL: "/uploadimg",
            onload: function () {
                console.log('onload', this);
            },
            /*指定需要显示的功能按钮*/
            toolbarIcons: function () {
                return ["undo", "redo", "|",
                    "bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|",
                    "h1", "h2", "h3", "h4", "h5", "h6", "|",
                    "list-ul", "list-ol", "hr", "|",
                    "link", "reference-link", "image", "code", "preformatted-text",
                    "code-block", "table", "datetime", "emoji", "html-entities", "pagebreak", "|",
                    "goto-line", "watch", "preview", "fullscreen", "clear", "search", "|",
                    "help", "info", "releaseIcon"]
            },

            /*自定义功能按钮，下面我自定义了2个，一个是发布，一个是返回首页*/
            toolbarIconTexts: {
                releaseIcon: "<span bgcolor=\"gray\" >发布</span>",
                // index : "<span bgcolor=\"red\">返回首页</span>",
            },

            /*给自定义按钮指定回调函数*/
            toolbarHandlers: {
                releaseIcon: function (cm, icon, cursor, selection) {
                    //表单提交
                    mdEditorForm.method = "post";
                    mdEditorForm.action = "/article/addArticle";//提交至服务器的路径
                    mdEditorForm.submit();
                }
                // index : function(){
                //     window.location.href = '/index';
                // },
            }
        });
    });
</script>


<!-- script -->
<script type='text/javascript' src='../../static/asserts/js/jquery-1.8.3.min.js'></script>
<script type='text/javascript' src='../../static/asserts/js/jquery.easing.1.34e44.js?ver=1.3'></script>
<script type='text/javascript' src='../../static/asserts/js/prettyphoto/jquery.prettyPhotoaeb9.js?ver=3.1.4'></script>
<script type='text/javascript' src='../../static/asserts/js/jquery.liveSearchd5f7.js?ver=2.0'></script>
<script type='text/javascript' src='../../static/asserts/js/jflickrfeed.js'></script>
<script type='text/javascript' src='../../static/asserts/js/jquery.formd471.js?ver=3.18'></script>
<script type='text/javascript' src='../../static/asserts/js/jquery.validate.minfc6b.js?ver=1.10.0'></script>
<script type='text/javascript' src='../../static/asserts/js/custom5152.js?ver=1.0'></script>
</body>
</html>